<script setup>
import {ref} from "vue"
import Toml from "./utils/toml"
import {useRouter} from "vue-router"
import {initMenus} from "./router/util"
import LayoutBase from "./layout/base.vue"

const router = useRouter();
const path = location.href.replace(location.origin,'')
const menu = ref(null)
const init = async () => {
  const m = await Toml.load('/menu.toml');
  initMenus(m.menus,router)
  menu.value = m;
  // 确保路由加载之后跳转成功
  router.push(path)
  console.log(router.getRoutes())
}

init();

console.log('menu == ',menu)
</script>

<template>
  <layout-base :menu="menu"></layout-base>
</template>

